package com.company.admin.controller.job.plan.school;

import com.company.admin.common.annotations.VisitAble;
import com.company.admin.common.result.ResultResponse;
import com.company.admin.domain.job.plan.school.SchoolJobPlanListResponse;
import com.company.admin.req.job.plan.school.SchoolJobPlanDeleteRequest;
import com.company.admin.req.job.plan.school.SchoolJobPlanListRequest;
import com.company.admin.req.job.plan.school.SchoolJobPlanRequest;
import com.company.admin.service.job.plan.school.SchoolJobPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @program: myProject
 * @description: ${description}
 * @author: zhaochenglin
 * @create: 2019-03-03 17:35
 **/
@RequestMapping("/school/job/plan")
@Controller
public class SchoolJobPlanController {

    @Autowired
    private SchoolJobPlanService schoolJobPlanService;


    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<String> add(@RequestBody SchoolJobPlanRequest request){
        schoolJobPlanService.add(request);
        return ResultResponse.onSuccess("success", null);
    }

    @RequestMapping(value = "/modify", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<String> modify(@RequestBody SchoolJobPlanRequest request){
        schoolJobPlanService.modify(request);
        return ResultResponse.onSuccess("success", null);
    }

    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<String> delete (@RequestBody SchoolJobPlanDeleteRequest request){
        schoolJobPlanService.delete(request);
        return ResultResponse.onSuccess("success", null);
    }

    @VisitAble
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public ResultResponse<SchoolJobPlanListResponse> list(@RequestBody SchoolJobPlanListRequest request){
        return ResultResponse.onSuccess(schoolJobPlanService.list(request), null);
    }
}
